package builder;

import java.util.Vector;

import model.Action;
import utilities.EPatterns;

public class PatternFactory {
	
    Vector<String> names = new Vector<String>();

	public PatternFactory(Vector<String> names) {
		this.names = names;
	}
	
	public Vector<Action> createPattern (EPatterns pattern) {
		
		Vector<Action> patternActions = new Vector<Action>();
		AbstractPatternBuilder abstractPatternBuilder = null;
		
		switch(pattern) {
		
			case AbstractFactory: { 
				abstractPatternBuilder = new AbstractFactoryBuilder ();
				break;
			}
			case Adapter: {
				abstractPatternBuilder = new AdapterBuilder ();
				break;
			}
			case Bridge: {
				abstractPatternBuilder = new BridgeBuilder ();
				break;
			}
			case Builder: {
				abstractPatternBuilder = new BuilderBuilder ();
				break;
			}
			case ChainOfResponsability: {
				abstractPatternBuilder = new ChainOfResponsabilityBuilder();
				break;
			}
			case Command: {
				abstractPatternBuilder = new CommandBuilder();
				break;
			}
			case Composite: {
				abstractPatternBuilder = new CompositeBuilder();
				break;
			}
			case Decorator: {
				abstractPatternBuilder = new DecoratorBuilder();
				break;
			}
			case FactoryMethod: {
				abstractPatternBuilder = new FactoryMethodBuilder();
				break;
			}
			case Flyweight: {
				abstractPatternBuilder = new FlyweightBuilder();
				break;
			}
			case Interpreter: {
				abstractPatternBuilder = new InterpreterBuilder();
				break;
			}
			case Iterator: {
				abstractPatternBuilder = new IteratorBuilder();
				break;
			}
			case Mediator: {
				abstractPatternBuilder = new MediatorBuilder();
				break;
			}
			case Memento: {
				abstractPatternBuilder = new MementoBuilder();
				break;
			}
			case Observer: {
				abstractPatternBuilder = new ObserverBuilder();
				break;
			}
			case Prototype: {
				abstractPatternBuilder = new PrototypeBuilder();
				break;
			}
			case Proxy: {
				abstractPatternBuilder = new ProxyBuilder();
				break;
			}
			case State: {
				abstractPatternBuilder = new StateAndStrategyBuilder();
				break;
			}
			case Strategy: {
				abstractPatternBuilder = new StateAndStrategyBuilder();
				break;
			}
//			case TemplateMethod: {
//				abstractPatternBuilder = new TemplateMethodBuilder();
//				break;
//			}
			case Visitor: {
				abstractPatternBuilder = new VisitorBuilder();
				break;
			}
			default: break;
				
		}
		
		abstractPatternBuilder.setNames(names);
		patternActions = abstractPatternBuilder.build();
		
		return patternActions;
	}

}
